package com.yyd.designmodel.observer.impl;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @Description：[ 管理器，管理作者 列表 ]
 *
 * @ProjectName：[designmodel]
 * @PackageName：[com.yyd.designmodel.observer.impl.WriterManager]
 * @CreateDate：[2015-1-20  上午11:44:56] 
 * @Author：[yuyidi]
 */
public class WriterManager {
    private Map<String, Writer> writers = new HashMap<String, Writer>();
    
    //添加作者
    public void add(Writer writer){
        writers.put(writer.getName(), writer);
    }
    
    //根据作者名获取作者
    public Writer getWriter(String name){
        return writers.get(name);
    }
    
    public WriterManager() {
    }
    
    public static WriterManager getInstence(){
        return WriterManagerInstance.instance;
    }
    
    private static class WriterManagerInstance{
        private static WriterManager instance = new WriterManager();
    }
}
